/**
 * @file     isSubsequence.js
 * @brief    [392. 判断子序列](https://leetcode.cn/problems/is-subsequence/description/)
 * @author   Zhu
 * @date     2023-02-12 19:25
 */

/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var isSubsequence = function (s, t) {
    let i = 0,
        j = 0;

    while (i < s.length && j < t.length) {
        if (t[j] === s[i]) {
            i++;
        }
        j++;
    }

    return i === s.length;
};
